<template>
  <div>
    <!-- 应用 sync -->
    <button @click="plus1" style="width: 100px">应用sync (+1)</button>
    <p>sync用法（子组件）：{{ msg }}</p>
  </div>
</template>

<script>
export default {
  props: {
    msg: [String, Number, null],
  },
  methods: {
    plus1() {
      this.$emit("update:msg", this.msg * 1 + 1);
    },
  },
  created() {
    this.t = this.msg;
  },
};
</script>
